package com.board.dao;

import com.board.entity.Resource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 小叶
 * @since 2024年04月03日
 */
@Mapper
public interface ResourceMapper extends BaseMapper<Resource> {

    @Select("select r.* from account_role ar\n" +
            "LEFT JOIN role_resource rr on ar.ROLE_ID=rr.ROLE_ID\n" +
            "LEFT JOIN resource r on rr.RESORUCE_ID=r.ID\n" +
            "where ar.ACCOUNT_ID=#{accountId} and r.level<3")
    List<Resource> findMenu(Integer accountId);
}
